{% extends "base.html" %}
{% block title %}Formularios{% endblock %}
{% block mainframe %}

			{% if forms %}
				<h1>Formularios</h1>
				<h2>Lista de formularios</h2>
				<table id="formstable">
				<thead>
					<td><span class="tableelement">ID</span></td>
					<td><span class="tableelement">Nombre</span></td>
					<td><span class="tableelement">Version</span></td>
					<td><span class="tableelement">Acciones</span></td>
				</thead>
				<tbody>
				{% for form in forms %}
					<tr>
						<td>
							<span class="tableelement">{{ form.id }}</span>
						</td>
						<td>
							<a href="/beekeeper/show_form/{{ form.id }}"><span class="tableelement">{{ form.name }}</span></a>
						</td>
						<td>
							<span class="tableelement">{{ form.version }}</span>
						</td>
						<td>
							<!--<a href="/beekeeper/delete_form/{{ form.id }}"><span class="tableelement"><img class="delete" src="/beekeeper/images/buttons/delete.png" /></span></a>-->
						    <form name="elementDelete" action="/beekeeper/show_form_list/" method="post">
						        {% csrf_token %}
						        <input type="hidden" name="elementToDelete" value="{{ form.id }}" />
						        <input type="image" src="/beekeeper/images/buttons/delete.png" name="submit" />
								<!--<a href="document.elementDelete.submit();"><span class="tableelement"><img class="delete" src="/beekeeper/images/buttons/delete.png" /></span></a>-->
						    </form>
							<a href="/beekeeper/show_instance_list/{{ form.id }}"><span class="tableelement">Instancias</span></a>
							<a href="/beekeeper/show_form_statistics/{{ form.id }}"><span class="tableelement">Estad&iacute;sticas</span></a>
							<a href="/beekeeper/show_instances_map/{{ form.id }}"><span class="tableelement">Geolocalizaciones</span></a>
						</td>
					</tr>
				{% endfor %}
				</tbody>
					<tfoot></tfoot>
				</table>
				<br/>
			{% else %}
				<br />
				<h3>No se ha encontrado ning&uacute;n formulario en la base de datos.</h3>
			{% endif %}

{% endblock %}


{% block result %}
	{% if deleting %}
      <p class="enlaceeliminar">¿Desea eliminar el formulario y todas sus instancias? <br /><a href="/beekeeper/delete_form/{{ formToDelete }}">Sí, eliminar formulario.</a></p>
    {% endif %}
{% endblock %}


{% block extrajs %}
	{% if deleting %}
		<script language="JavaScript">
			$("#resultado").toggle('slow');
	    </script>
    {% endif %}
{% endblock %}